
package at.sphinx.testframework;

import java.lang.reflect.Field;


public class SimpliestInjector {
	
	public static Object inject(Object target, String fieldName, Object toInject) {
		try {
			Field f = target.getClass().getDeclaredField(fieldName);
			f.setAccessible(true);
			f.set(target, toInject);
			f.setAccessible(false);
		} catch (Exception ex) { // SecurityException, NoSuchFieldException
			throw new RuntimeException(ex);
		}
		return target;
	}
	
}
